package com.yanjr.modules.cms.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.yanjr.common.persistence.BaseDao;
import com.yanjr.modules.cms.entity.Category;

/**
 * 栏目DAO接口
 * @ClassName: CategoryDao 
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @author yanjr  2016年5月26日 上午9:33:41
 */
@Repository
public interface CategoryDao extends BaseDao<Category> {
	
	List<Category> findByParentIdsLike(String parentIds);

	List<Category> findByModule(String module);
	
	List<Category> findByParentId(String parentId, String isMenu);

	List<Category> findByParentIdAndSiteId(String parentId, String siteId);
	
	List<Category> findByIdIn(String[] ids);

//	@Query("select distinct c from Category c, Role r, User u where c in elements (r.categoryList) and r in elements (u.roleList)" +
//			" and c.delFlag='" + Category.DEL_FLAG_NORMAL + "' and r.delFlag='" + Role.DEL_FLAG_NORMAL + 
//			"' and u.delFlag='" + User.DEL_FLAG_NORMAL + "' and u.id=?1 or (c.user.id=?1 and c.delFlag='" + Category.DEL_FLAG_NORMAL +
//			"') order by c.site.id, c.sort")
//	public List<Category> findByUserId(Long userId);
	
}
